package com.example.web;

import com.example.common.ServiceResponse;
import com.example.common.TableServerResponse;
import com.example.service.IPropertyService;
import com.example.vo.PropertyListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: gxcwhd
 * @BelongsPackage: com.example.web
 * @Author: LJ
 * @CreateTime: 2020-08-14 16:49
 * @Description:
 */
@RequestMapping("Property")
@RestController
//@CrossOrigin
public class PropertyController {
    @Autowired
    IPropertyService propertyService;

    //分页查物业
    @RequestMapping("get-propertylist")
    public TableServerResponse getPropertyList(Integer page,Integer limit){
        return propertyService.getPropertyList(page,limit);
    }

    //模糊查询物业
    @RequestMapping("search-property")
    public TableServerResponse serrchPropery(PropertyListVO propertyListVO){
        return propertyService.searchPropery(propertyListVO);
    }

    //查省
    @RequestMapping("get-province")
    public ServiceResponse getProvince(){
        return propertyService.getProvince();
    }

    //查城市
    @RequestMapping("get-city")
    public ServiceResponse getCity(String provinceCode){
        return propertyService.getCity(provinceCode);
    }

    //查地区
    @RequestMapping("get-area")
    public ServiceResponse getArea(String cityCode){
        return propertyService.getArea(cityCode);
    }

    //查街道
    @RequestMapping("get-street")
    public ServiceResponse getStreet(String areaCode){
        return propertyService.getStreet(areaCode);
    }

    //添加物业
    @RequestMapping("add-property")
    public ServiceResponse addProperty(PropertyListVO propertyListVO){

        return propertyService.addProperty(propertyListVO);
    }

    //查全部
    @RequestMapping("get-allstreet")
    public ServiceResponse getAllStreet(){
        return propertyService.getAllStreet();
    }

    //修改物业信息
    @RequestMapping("update-property")
    public ServiceResponse updateProperty(PropertyListVO propertyListVO){
        return propertyService.updateProperty(propertyListVO);
    }
}
